//
//  ViewController.m
//  NewProject
//
//  Created by 李航飞 on 2017/6/4.
//  Copyright © 2017年 李航飞. All rights reserved.
//

#import "ViewController.h"
#import "LoginViewController.h"
#import "FunctionVC.h"
#import "MainVC.h"
#import "ServiceVC.h"
#import "PersonVC.h"

@interface ViewController ()

@end

@implementation ViewController
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden=YES;
}
- (void)viewWillDisappear:(BOOL)animated{
    [super viewDidDisappear:animated];
    self.navigationController.navigationBarHidden=NO;
}
//- (void)viewDidDisappear:(BOOL)animated{
//    [super viewDidDisappear:animated];
//    self.navigationController.navigationBarHidden=NO;
//}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"";
    self.view.backgroundColor=[UIColor redColor];
//    self.navigationController.navigationBar.hidden=NO;
    
    
    
    [self setUpView];
    // Do any additional setup after loading the view, typically from a nib.
}
- (void)setUpView{
    
    UIImageView *img=[[UIImageView alloc] initWithFrame:self.view.bounds];
    img.backgroundColor=[UIColor orangeColor];
    [img setImage:[UIImage imageNamed:@"di01.jpg"]];
//    [img setImage:[UIImage imageNamed:@"shouye.png"]];
    [self.view addSubview:img];
    UIButton *btn=[[UIButton alloc] initWithFrame:CGRectMake(self.view.frame.size.width/3/3, self.view.frame.size.height-150, self.view.frame.size.width/3, 40)];
    [btn setTitle:@"登录" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(godenglu) forControlEvents:UIControlEventTouchUpInside];
    [btn.layer setCornerRadius:10.0]; //设置矩形四个圆角半径
    [btn.layer setBorderWidth:2.0]; //边框宽度
    btn.backgroundColor=[UIColor colorWithRed:250/255.0 green:214/255.0 blue:66/255.0 alpha:1];
    CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();
    CGColorRef color1 = CGColorCreate(colorSpaceRef, (CGFloat[]){0/255.0,0/255.0,0/255.0,1});
    [btn.layer setBorderColor:color1];
    [self.view addSubview:btn];
    
    UIButton *btn1=[[UIButton alloc] initWithFrame:CGRectMake(self.view.frame.size.width/3/3+self.view.frame.size.width/3+self.view.frame.size.width/3/3, self.view.frame.size.height-150, self.view.frame.size.width/3, 40)];
    [btn1 setTitle:@"去看看" forState:UIControlStateNormal];
    [btn1 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [btn1 setTitleColor:[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1] forState:UIControlStateNormal];
    [btn1.layer setCornerRadius:10.0]; //设置矩形四个圆角半径
    [btn1.layer setBorderWidth:2.0]; //边框宽度
    CGColorSpaceRef colorSpaceRef1 = CGColorSpaceCreateDeviceRGB();
    CGColorRef color = CGColorCreate(colorSpaceRef1, (CGFloat[]){0/255.0,0/255.0,0/255.0,1});
    [btn1.layer setBorderColor:color];
    [btn1 addTarget:self action:@selector(looklook) forControlEvents:UIControlEventTouchUpInside];
     btn1.backgroundColor=[UIColor colorWithRed:250/255.0 green:214/255.0 blue:66/255.0 alpha:1];
    [self.view addSubview:btn1];
    
}
- (void)godenglu{
    
    LoginViewController *loginVC=[[LoginViewController alloc] init];
//    UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:loginVC];
//    nav.title=@"123";
//    [self presentViewController:loginVC animated: NO completion:nil];
    [self.navigationController pushViewController:loginVC animated:YES];
    NSLog(@"123");
}

- (void)looklook{
    [[NSNotificationCenter defaultCenter] postNotificationName:@"setUpTabbar" object:self userInfo:nil];

}


/*
- (void)looklook{
    
    UITabBarController *tabbar = [[UITabBarController alloc] init];
    
    MainVC *mainVC = [[MainVC alloc] init];
    
    UINavigationController *mainN = [[UINavigationController alloc] initWithRootViewController: mainVC];
    mainVC.title = @"主页";
    
    FunctionVC *funVC = [[FunctionVC alloc] init];
    UINavigationController *funN = [[UINavigationController alloc] initWithRootViewController: funVC];
    funVC.title = @"功能";
    
    ServiceVC *serVC = [[ServiceVC alloc] init];
    UINavigationController *serN = [[UINavigationController alloc] initWithRootViewController: serVC];
    serVC.title = @"服务";
    
    PersonVC *perVC = [[PersonVC alloc] init];
    UINavigationController *perN = [[UINavigationController alloc] initWithRootViewController:perVC];
    perVC.title = @"个人中心";
    
    tabbar.navigationController.navigationBarHidden=YES;
    
    tabbar.viewControllers = @[mainN,funN,serN,perN];
    

    
    UIWindow *window = [[UIWindow alloc] initWithFrame:self.view.frame];
    window.rootViewController = tabbar;
    
    [window makeKeyAndVisible];
    
    
   // [self.navigationController pushViewController:tabbar animated:YES];
    
    
}
*/

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
